﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NeuralNetworkComponents
{
    public class SigmoidFunction : IActivationFunction
    {
        public Double Alpha { get; set; }

        public SigmoidFunction()
            : this(2.0) { }

        public SigmoidFunction(Double alpha)
        {
            this.Alpha = alpha;
        }

        public Double Function(Double x)
        {
            return (1 / (1 + Math.Exp(-Alpha * x)));
        }

        public Double Derivative(Double x)
        {
            Double y = Function(x);
            return (Alpha * y * (1 - y));
        }

        public Double Derivative2(Double x)
        {
            return 0.0;
        }
    }
}
